import { readFileSync } from "fs";
import { marked } from "marked";

export default function MarkdownPlugin() {
  return {
    name: "vite-plugin-md",
    transform(src: string, id: string) {
      if (id.endsWith(".md")) {
        const html = marked.parse(src);
        return `export default ${JSON.stringify(html)}`;
      }
    },
  };
}
